//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CMainBatch.h>
///	@path	~/src/graphics/batch/
///	@date	2008/04/26
///	@desc	Main batch, organize sub batches.

#pragma once

#include "xeres.h"

#include "graphics/IBatch.h"
#include "graphics/batch/CStaticModelBatch.h"
#include "graphics/batch/CDrawCallsBatch.h"

namespace xeres {

	/*!	
		\class	CMainBatch
		\brief	Main batch, organize sub batches.
	*/
	class CMainBatch : public IBatch
	{
	public:

		/// \ctor
		CMainBatch( void );

		/// \dtor
		virtual ~CMainBatch( void );

		DECL_IOBJECT_CLASS_DYNAMIC( CMainBatch , IBatch );

	public:

		/// \impl	IBatch::BeginBatch
		virtual void BeginBatch( void );

		/// \impl	IBatch::EndBatch
		virtual void EndBatch( void );

		/// \impl	IBatch::Render
		virtual void Render( RenderContext& rc );

		/// \name Sub Batch
		//@{

		/// \brief	Add draw calls.
		void BatchDrawCall( const function<void(RenderContext&)>& dc );

		/// \brief	Add model.
		void BatchModel( RefWeak<IModel> model );

		//@}

	private:

		//@ data

		Ref< CStaticModelBatch >		m_models;

		Ref< CDrawCallsBatch >			m_dc;

	};

} // namespace xeres
